package net.sx.minemodule.widget;

import android.content.Context;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.kedll.library.util.BindingUtil;

import net.sx.minemodule.R;

/**
 * @author 11470
 */
public class MineHeadView extends FrameLayout {

    private View view;
    /**
     * 头像
     */
    private ImageView ivUserHeadMine;
    /**
     * 昵称
     */
    private TextView tvUserNickNameMine;
    /**
     * 设置
     */
    private ImageView ivSettingMine;
    /**
     * 普通或者超级会员
     */
    private ImageView ivTypeMember;
    /**
     * 超级会员
     */
//    private RelativeLayout rlnSuperMemberLayoutMine;      //del shibo.zheng 19/06/13
    /**
     * 我的订单
     */
    private LinearLayout lvnAllOrderMine;
    /**
     * 待付款
     */
    private LinearLayout lvnWaitPayOrderMine;
    /**
     * 待发货
     */
    private LinearLayout lvnWaitDeliverOrderMine;
    /**
     * 待收货
     */
    private LinearLayout lvnWaitReceivingOrderMine;
    /**
     * 待评价
     */
    private LinearLayout lvnEvaluateOrderMine;
    /**
     * 退款/售后
     */
    private LinearLayout lvnAfterSaleOrderMine;
    /**
     * 我的收藏
     */
    private LinearLayout lvnGoodsCollectMine;
    /**
     * 我的大洋
     */
//    private LinearLayout lvnMoneyMine;
    /**
     * 我的积分
     */
    private LinearLayout lvnIntegralMine;
    /**
     * 我的佣金
     */
    private LinearLayout lvnBrokerageMine;
    /**
     * 我的奖牌
     */
    private LinearLayout lvnMedalMine;
    /**
     * 我的推广码
     */
    private LinearLayout lvnPromotionCodeMine;
    /**
     * 我是调研员
     */
    private LinearLayout lvnResearcherMine;
    /**
     * 个人主页
     */
    private LinearLayout lvnStyListHomeMine;
    /**
     * 我的粉丝
     */
    private LinearLayout lvnAttentionListMine;
    /**
     * 我的作品
     */
    private LinearLayout lvnProductionMine;

//    /**头像*/
//    private String headPath;
//    /**昵称*/
//    private String nickName;
//    /**0普通会员 1超级会员*/
//    private int memberType;

    public MineHeadView(@NonNull Context context) {
        this(context, null);
    }

    public MineHeadView(@NonNull Context context, @Nullable AttributeSet attrs) {
        this(context, attrs, 0);
    }

    public MineHeadView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        initView(context);
    }

    private void initView(Context context) {
        view = LayoutInflater.from(context).inflate(R.layout.mine_view_mine_head_bar, this, true);
        ivUserHeadMine = view.findViewById(R.id.iv_user_head_mine);
        tvUserNickNameMine = view.findViewById(R.id.tv_user_nick_name_mine);
        ivSettingMine = view.findViewById(R.id.iv_setting_mine);
        ivTypeMember = view.findViewById(R.id.iv_type_member);
//        rlnSuperMemberLayoutMine = view.findViewById(R.id.rln_super_member_layout_mine);
        lvnAllOrderMine = view.findViewById(R.id.lvn_all_order_mine);
        lvnWaitPayOrderMine = view.findViewById(R.id.lvn_wait_pay_order_mine);
        lvnWaitDeliverOrderMine = view.findViewById(R.id.lvn_wait_deliver_order_mine);
        lvnWaitReceivingOrderMine = view.findViewById(R.id.lvn_wait_receiving_order_mine);
        lvnEvaluateOrderMine = view.findViewById(R.id.lvn_evaluate_order_mine);
        lvnAfterSaleOrderMine = view.findViewById(R.id.lvn_after_sale_order_mine);
        lvnGoodsCollectMine = view.findViewById(R.id.lvn_goods_collect_mine);
        lvnIntegralMine = view.findViewById(R.id.lvn_money_mine);
        lvnBrokerageMine = view.findViewById(R.id.lvn_brokerage_mine);
        lvnMedalMine = view.findViewById(R.id.lvn_medal_mine);
        lvnPromotionCodeMine = view.findViewById(R.id.lvn_promotion_code_mine);
        lvnResearcherMine = view.findViewById(R.id.lvn_researcher_mine);

        lvnStyListHomeMine = view.findViewById(R.id.lvn_stylist_home_mine);
        lvnAttentionListMine = view.findViewById(R.id.lvn_attention_list_mine);
        lvnProductionMine = view.findViewById(R.id.lvn_production_mine);

    }

    public void setUserHead(String userHead) {
        if (ivUserHeadMine != null) {
            if (!TextUtils.isEmpty(userHead.trim())) {
                BindingUtil.loadCircleImage(ivUserHeadMine, userHead, null);
            }
        }
    }

    public void setName(String nickName) {
        if (tvUserNickNameMine != null && nickName != null) {   //add && shibo.zheng
            if (!TextUtils.isEmpty(nickName.trim())) {
                tvUserNickNameMine.setText(nickName);
            }
        }
    }

    public void setMemberType(String memberType) {
        if (ivTypeMember != null && memberType != null) {   //add && shibo.zheng
            if (memberType.equals("普通客户")) {
                ivTypeMember.setImageResource(R.mipmap.ordinary_users);
            } else {
                ivTypeMember.setImageResource(R.mipmap.super_member);
            }
        }
    }

    public void setSettingClickListener(OnClickListener onClickListener) {
        if (ivSettingMine != null) {
            ivSettingMine.setOnClickListener(onClickListener);
        }
    }

    //del shibo.zheng 19/06/13
//    public void setSuperMemberLayoutClickListener(OnClickListener onClickListener) {
//        if (rlnSuperMemberLayoutMine != null) {
//            rlnSuperMemberLayoutMine.setOnClickListener(onClickListener);
//        }
//    }

    public void setAllOrderClickListener(OnClickListener onClickListener) {
        if (lvnAllOrderMine != null) {
            lvnAllOrderMine.setOnClickListener(onClickListener);
        }
    }

    public void setWaitPayOrderClickListener(OnClickListener onClickListener) {
        if (lvnWaitPayOrderMine != null) {
            lvnWaitPayOrderMine.setOnClickListener(onClickListener);
        }
    }

    public void setWaitDeliverOrderClickListener(OnClickListener onClickListener) {
        if (lvnWaitDeliverOrderMine != null) {
            lvnWaitDeliverOrderMine.setOnClickListener(onClickListener);
        }
    }

    public void setWaitReceivingOrderClickListener(OnClickListener onClickListener) {
        if (lvnWaitReceivingOrderMine != null) {
            lvnWaitReceivingOrderMine.setOnClickListener(onClickListener);
        }
    }

    public void setEvaluateOrderClickListener(OnClickListener onClickListener) {
        if (lvnEvaluateOrderMine != null) {
            lvnEvaluateOrderMine.setOnClickListener(onClickListener);
        }
    }

    public void setAfterSaleOrderClickListener(OnClickListener onClickListener) {
        if (lvnAfterSaleOrderMine != null) {
            lvnAfterSaleOrderMine.setOnClickListener(onClickListener);
        }
    }

    //我的收藏
    public void setGoodsCollectClickListener(OnClickListener onClickListener) {
        if (lvnGoodsCollectMine != null) {
            lvnGoodsCollectMine.setOnClickListener(onClickListener);
        }
    }

    //我的积分
    public void setIntegralMineClickListener(OnClickListener onClickListener) {
        if (lvnIntegralMine != null) {
            lvnIntegralMine.setOnClickListener(onClickListener);
        }
    }

    //我的佣金
    public void setBrokerageMineMineClickListener(OnClickListener onClickListener) {
        if (lvnBrokerageMine != null) {
            lvnBrokerageMine.setOnClickListener(onClickListener);
        }
    }

    //我的奖牌
    public void setMedalMineMineClickListener(OnClickListener onClickListener) {
        if (lvnMedalMine != null) {
            lvnMedalMine.setOnClickListener(onClickListener);
        }
    }

    //我的推广码
    public void setPromotionCodeMineMineClickListener(OnClickListener onClickListener) {
        if (lvnPromotionCodeMine != null) {
            lvnPromotionCodeMine.setOnClickListener(onClickListener);
        }
    }

    //我是调研员
    public void setResearcherMineMineMineClickListener(OnClickListener onClickListener) {
        if (lvnResearcherMine != null) {
            lvnResearcherMine.setOnClickListener(onClickListener);
        }
    }

   /* public void setMoneyMineClickListener(OnClickListener onClickListener) {
        if (lvnMoneyMine != null) {
            lvnMoneyMine.setOnClickListener(onClickListener);
        }
    }

    public void setPayGiftMineClickListener(OnClickListener onClickListener) {
        if (lvnPayGiftMine != null) {
            lvnPayGiftMine.setOnClickListener(onClickListener);
        }
    }

    public void setPackageMineClickListener(OnClickListener onClickListener) {
        if (lvnPackageMine != null) {
            lvnPackageMine.setOnClickListener(onClickListener);
        }
    }

    public void setGiftMineClickListener(OnClickListener onClickListener) {
        if (lvnGiftMine != null) {
            lvnGiftMine.setOnClickListener(onClickListener);
        }
    }

    public void setMsgMineClickListener(OnClickListener onClickListener) {
        if (lvnMsgMine != null) {
            lvnMsgMine.setOnClickListener(onClickListener);
        }
    }

    public void setAboutMineClickListener(OnClickListener onClickListener) {
        if (lvnAboutMine != null) {
            lvnAboutMine.setOnClickListener(onClickListener);
        }
    }*/

    public void setStyListHomeClickListener(OnClickListener onClickListener) {
        if (lvnStyListHomeMine != null) {
            lvnStyListHomeMine.setOnClickListener(onClickListener);
        }
    }

    public void setAttentionListClickListener(OnClickListener onClickListener) {
        if (lvnAttentionListMine != null) {
            lvnAttentionListMine.setOnClickListener(onClickListener);
        }
    }

    public void setProductionMineClickListener(OnClickListener onClickListener) {
        if (lvnProductionMine != null) {
            lvnProductionMine.setOnClickListener(onClickListener);
        }
    }


}
